﻿#region 命名空间

using System;
using System.Diagnostics;
using System.Text;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Sharp.Infrastructure;
using Sharp.Infrastructure.Crosscutting;

#endregion

namespace Sharp.Web
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            new AutoMapperBootStrapper().Initialize();
        }
        protected void Application_Error(object sender, EventArgs e)
        {
            var lastError = Server.GetLastError().InnerException ?? Server.GetLastError();

            LogHelper.Write(lastError, Category.General, Priority.High, TraceEventType.Error);
        }
        //protected void Application_AcquireRequestState()
        //{
        //    string licenseKey = "net,5,2018-11-11";
        //    byte[] b = Encoding.Default.GetBytes(licenseKey);
        //    licenseKey = Convert.ToBase64String(b);
        //    Session["Ext.Net.LicenseKey"] = licenseKey;
        //}
    }
}